Home | 简体中文 | 繁体中文 | 杂文 | 知乎专栏 | 51CTO学院 | CSDN程序员研修院 | Github | OSChina 博客 | 腾讯云社区 | 阿里云栖社区 | Facebook | Linkedin | Youtube | 打赏(Donations) | About
知乎专栏多维度架构

2.4. 转出账号中所有 ETH,Ethereum Wallet 中的 Send everything 实现方法

		
> personal.unlockAccount(eth.accounts[3], "12345678")
true

> eth.sendTransaction({from: eth.accounts[3], to: eth.accounts[5], value: eth.getBalance(eth.accounts[3]) - cost, gas: estimateGas})
"0x4e27a477e128b200239bc2ecd899077c6ae064da963a919fef41bcc7462aec8d"
		
		

查看交易细节

		
> web3.eth.getTransaction("0x4e27a477e128b200239bc2ecd899077c6ae064da963a919fef41bcc7462aec8d")
{
  blockHash: "0x59a9905831e7ae3cb9e7c6f125cf48e2688ef4b39317838f6f6b6c8837d01404",
  blockNumber: 4367,
  from: "0x8efb99ec55bcfbe2cfe47918f2d9e55fa732111f",
  gas: 21000,
  gasPrice: 18000000000,
  hash: "0x4e27a477e128b200239bc2ecd899077c6ae064da963a919fef41bcc7462aec8d",
  input: "0x",
  nonce: 15,
  r: "0xa297401df3a1fb0298cbc1dd609deebe9ded319fadc55934ecef4d525198215",
  s: "0x780d8c46bc8d1bb89ae9d78055307d9d68a4f89ba699ef86d3f8ba88383139a6",
  to: "0xf0688330101d53bd0c6ede2ef04d33c2010e9a5d",
  transactionIndex: 0,
  v: "0x42",
  value: 999622000000000000
}
		
		
		

现在查看from账号,余额已经清零。

		
> eth.getBalance(eth.accounts[3])
0